package org.tacademy.and12th.jyh.buckeybuckey;
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;


public class MainHorizontalScrollViewAdapter extends BaseAdapter {
	ArrayList<HorizontalScrollViewData> nList;
	LayoutInflater inflater;
	Context nContext;
//	String BucketName ="";

	
	public MainHorizontalScrollViewAdapter (Context context,  ArrayList<HorizontalScrollViewData> list ) {
		inflater = LayoutInflater.from(context);
		nContext = context;
		nList = list;
//		mBucketName = BucketName;
	}
	public void add(HorizontalScrollViewData data) {
		nList.add(data);
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return nList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return nList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ImageItemView v;
		if(convertView == null) {
			v = new ImageItemView(nContext);
		} else {
			v = (ImageItemView) convertView;
		}
		HorizontalScrollViewData item = nList.get(position);
		v.setData(item);
		
		return v;
	}

}
